package service;

import java.math.BigInteger;
import java.util.List;

import beans.Company;

import dao.CompanyDao;
import dao.QueryDAO;


public class CompanyService implements CompanyServiceInterface {

    private List<Company> companies = null;

    QueryDAO queryDAO = new QueryDAO();
    CompanyDao companyDao = new CompanyDao();

    String sql = null;
    String hql = null;

    @Override
    public List<Company> getCompanyes(int rows, int page) {
        return companyDao.getCompanyes(rows, page);
    }

    @Override
    public int getCompanyNumber() {
        sql = "select count(c.company_id) from company c";
        return ((BigInteger)queryDAO.queryUniques(sql)).intValue();
    }

    @Override
    public void deleteCompany(String ids) {
        sql = "delete from company where company_id in ("+ids+")";
        queryDAO.queryExcute(sql);
    }

}